Fix #include in gbsleep for Windows. Add fallback to integer sleep.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 8 Apr 2006 19:10:48 +0000 (19:10 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 8 Apr 2006 19:10:48 +0000 (19:10 +0000)
gpsbabel/gbsleep.c

index 868be5529608a3f4b7d5234c1c98d388bb5ea4f3..77e106e1d213f78795474feb8f008d75fa7fb02f 100644 (file)
@@ -22,7 +22,7 @@
 
 #if __WIN32__
 
-#include <winbase.h>
+#include <windows.h>
 void
 gb_sleep(unsigned long microseconds)
 {
@@ -32,6 +32,7 @@ gb_sleep(unsigned long microseconds)
 #elif defined HAVE_NANOSLEEP
 
 #include <time.h>
+void
 gb_sleep(unsigned long microseconds)
 {
        struct timespec req;
@@ -39,4 +40,12 @@ gb_sleep(unsigned long microseconds)
        req.tv_nsec = (microseconds * 1000) % 1000000000;
        nanosleep(&req, NULL);
 }
+#elif defined HAVE_SLEEP
+/* Amazingly underachieving, but probably "good enough" */
+#include <unistd.h>
+void
+gbsleep(unsigned long microseconds)
+{
+       sleep(microseconds / 1000000);
+}
 #endif